package org.swingfly;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;

/**
 * Hello world!
 *
 */
@Aspect
public class App 
{
    public static void main( String[] args ) throws Exception
    {
        long begin = System.currentTimeMillis();
        for(int i=0;i<1000;i++){
            test1();
        }
        long end = System.currentTimeMillis();
        System.out.println("aspect:"+(end-begin));
        begin = System.currentTimeMillis();
        for(int i=0;i<1000;i++){
            test2();
        }
        end = System.currentTimeMillis();
        System.out.println("class:"+(end-begin));
    }

    public static void test1() throws InterruptedException {
        Thread.sleep(15);
    }

    public static void test2() throws InterruptedException {
        Thread.sleep(15);
    }

    @Around("execution(*  test1(..))")
    public Object aroundTraced(ProceedingJoinPoint thisJoinPoint) throws Throwable {
        return thisJoinPoint.proceed();
    }
}
